#pragma once

namespace exercise
{
	template<class Iterator, class Ref, class Ptr>
	struct Reserve_iterator
	{
		typedef Reserve_iterator<Iterator, Ref, Ptr> Self;

		Reserve_iterator(Iterator it)
			:_it(it)
		{}

		Ref operator*()
		{
			Iterator temp = _it;

			return *(--temp);
		}

		Ptr operator->()
		{
			return &(operator*());
		}

		Self& operator++()
		{
			--_it;
			return *this;
		}

		Self& operator--()
		{
			++_it;
			return *this;
		}


		bool operator!=(const Self& s)
		{
			return _it != s._it;
		}

		bool operator==(const Self& s)
		{
			return _it == s._it;
		}

		Iterator _it;
	};
}